<a href='https://github.com/angular/angular.js/edit/v1.5.x/docs/content/guide/production.ngdoc?message=docs(guide%2FRunning in Production)%3A%20describe%20your%20change...' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this Doc</a>


<h1 id="running-an-angularjs-app-in-production">Running an AngularJS App in Production</h1>
<p>There are a few things you might consider when running your AngularJS application in production.</p>
<h2 id="disabling-debug-data">Disabling Debug Data</h2>
<p>By default AngularJS attaches information about binding and scopes to DOM nodes,
and adds CSS classes to data-bound elements:</p>
<ul>
<li><p>As a result of <code>ngBind</code>, <code>ngBindHtml</code> or <code>{{...}}</code> interpolations, binding data and CSS class
<code>ng-binding</code> are attached to the corresponding element.</p>
</li>
<li><p>Where the compiler has created a new scope, the scope and either <code>ng-scope</code> or <code>ng-isolated-scope</code>
CSS class are attached to the corresponding element. These scope references can then be accessed via
<code>element.scope()</code> and <code>element.isolateScope()</code>.</p>
</li>
</ul>
<p>Tools like <a href="https://github.com/angular/protractor">Protractor</a> and
<a href="https://github.com/angular/angularjs-batarang">Batarang</a> need this information to run,
but you can disable this in production for a significant performance boost with:</p>
<pre><code class="lang-js">myApp.config([&#39;$compileProvider&#39;, function ($compileProvider) {
  $compileProvider.debugInfoEnabled(false);
}]);
</code></pre>
<p>If you wish to debug an application with this information then you should open up a debug
console in the browser then call this method directly in this console:</p>
<pre><code class="lang-js">angular.reloadWithDebugInfo();
</code></pre>
<p>The page should reload and the debug information should now be available.</p>
<p>For more see the docs pages on <a href="api/ng/provider/$compileProvider#debugInfoEnabled"><code>$compileProvider</code></a>
and <a href="api/ng/function/angular.reloadWithDebugInfo"><code>angular.reloadWithDebugInfo</code></a>.</p>
<h2 id="strict-di-mode">Strict DI Mode</h2>
<p>Using strict di mode in your production application will throw errors when an injectable
function is not
<a href="guide/di#dependency-annotation">annotated explicitly</a>. Strict di mode is intended to help
you make sure that your code will work when minified. However, it also will force you to
make sure that your injectable functions are explicitly annotated which will improve
angular&#39;s performance when injecting dependencies in your injectable functions because it
doesn&#39;t have to dynamically discover a function&#39;s dependencies. It is recommended to
automate the explicit annotation via a tool like
<a href="https://github.com/olov/ng-annotate">ng-annotate</a> when you deploy to production (and enable
strict di mode)</p>
<p>To enable strict di mode, you have two options:</p>
<pre><code class="lang-html">&lt;div ng-app=&quot;myApp&quot; ng-strict-di&gt;
  &lt;!-- your app here --&gt;
&lt;/div&gt;
</code></pre>
<p>or</p>
<pre><code class="lang-js">angular.bootstrap(document, [&#39;myApp&#39;], {
  strictDi: true
});
</code></pre>
<p>For more information, see the
<a href="guide/di#using-strict-dependency-injection">DI Guide</a>.</p>


